package com.ss.android.lockscreen;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;

import com.ss.android.lockscreen.activity.lock.LockScreenActivity;

public class bb {
    private static bb h;
    public com.ss.android.lockscreen.e.a b;
    public com.ss.android.lockscreen.e.e$e c;
    public com.ss.android.lockscreen.e.e$c d;
    public com.ss.android.lockscreen.e.d e;
    public com.ss.android.lockscreen.e.e$b f;
    public boolean g;
    Context a;
    private boolean i;

    public bb() {
        this.i = false;
        this.b = null;
        this.c = null;
        this.d = null;
        this.e = null;
        this.f = null;
        this.g = true;
    }

    public static bb a() {
        if (h == null) {
            Class v1 = bb.class;
            synchronized (v1) {
                if (h == null) {
                    h = new bb();
                }
            }
        }

        return h;
    }

    static void a(Context arg2, boolean arg3, Class arg4) {
        try {
            if ((Build.BRAND.equalsIgnoreCase("oppo")) && Build.VERSION.SDK_INT < 23) {
                if (arg3) {
                    arg2.startService(new Intent(arg2, arg4));
                } else {
                    arg2.stopService(new Intent(arg2, arg4));
                }

                return;
            }

            if (arg3) {
                arg2.startService(new Intent(arg2, arg4));
            } else {
                arg2.stopService(new Intent(arg2, arg4));
            }

            return;
        } catch (Throwable v0) {
            return;
        }
    }

    public static void b(Context arg2) {
        try {
            Intent v0_1 = new Intent(arg2, LockScreenActivity.class);
            v0_1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            v0_1.addFlags(65536);
            arg2.startActivity(v0_1);
        } catch (Throwable v0) {
        }
    }

    public static boolean c() {
        boolean v0 = !android.support.design.a.B.a() || !android.support.design.a.B.b() || !com.ss.android.lockscreen.c.b.a.a().a() ? false : true;
        return v0;
    }

    public static boolean d() {
        return com.ss.android.lockscreen.c.b.a.a().a();
    }

    public final void a(Context arg5) {
        if (!this.i) {
            this.i = true;
            this.a = arg5.getApplicationContext();
            Context v0 = this.a;
            String v1 = "lockscreen_settings";
            if (v0 == null) {
                throw new RuntimeException("context is null");
            } else {
                if (android.support.design.a.B == null) {
                    android.support.design.a.B = new com.ss.android.lockscreen.c.a.a(v0, v1);
                }

                com.ss.android.lockscreen.c.b.a.a(v0, "lockscreen_settings_server");
                com.ss.android.lockscreen.c.b.a.a(new com.ss.android.lockscreen.c.b.a.a$a(this));
                HandlerThread v0_1 = new HandlerThread("LockScreen.XX");
                v0_1.start();
                new Handler(v0_1.getLooper()).postDelayed(new com.ss.android.lockscreen.cc(this), 200);
            }
        }
    }

    public final void b() {
        if (this.a == null) {
            throw new RuntimeException("mContext is null");
        }

        new Thread(new com.ss.android.lockscreen.dd(this)).start();
    }
}

